﻿using AutoMapper;
using Ducu.BLL.Entity;
using Ducu.SRV.ViewModel.Shared;
using Entity = Ducu.BLL.Entity;

namespace Ducu.SRV.ProdService.ViewModelMap
{
    internal class SharedModelMap
    {
        internal static void Init()
        {
            Mapper.CreateMap<User, NameIdModel>()
                .ForMember(n => n.Name, opt => opt.MapFrom(r => r.Profile.DisplayName))
                ;

            Mapper.CreateMap<Keyword, NameIdModel>()
                .ForMember(n => n.Name, opt => opt.MapFrom(r => r.Content))
                ;

            Mapper.CreateMap<LinkModel, Entity.Component.Link>();
            Mapper.CreateMap<Entity.Component.Link, LinkModel>();
        }
    }
}
